//
//  Error.m
//  PacketSniffer
//
//  Created by nark on 01/05/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "PSError.h"

NSString *const PSReceiveErrorNotification = @"PSReceiveError";

@implementation PSError

@synthesize message;
@synthesize type;
@synthesize infos;

+ (void)notifyError:(PSError *)_error {
	NSMutableDictionary *userInfo = [[NSMutableDictionary alloc] init];
	[userInfo setValue:_error forKey:@"error"];
	
	NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
	[nc postNotificationName:PSReceiveErrorNotification
					  object:self
					userInfo:userInfo];
}

- (id) initWithType:(PSErrorType)_type message:(NSString *)_message infos:(NSArray *)_infos
{
	self = [super init];
	if (self != nil) {
		type = _type;
		message = _message;
		infos = _infos;
	}
	return self;
}

@end
